package com.cyj.service.impl;

import com.cyj.dao.AnimeRegionDao;
import com.cyj.entity.AnimeRegion;
import com.cyj.service.AnimeRegionService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AnimeRegionServiceImpl implements AnimeRegionService {

    @Autowired
    private AnimeRegionDao animeRegionDao;

    @Override
    public AnimeRegion selectAnimeRegion(Map map) {
        return animeRegionDao.selectAnimeRegion(map);
    }

    @Override
    public List<AnimeRegion> allAnimeRegion(Map map) {
        return animeRegionDao.selectAnimeRegionList(map);
    }

    @Override
    public PageInfo<AnimeRegion> selectAnimeRegionList(Map map, int pn, int pageSize) {
        PageHelper.startPage(pn,pageSize);

        List<AnimeRegion> list = animeRegionDao.selectAnimeRegionList(map);

        PageInfo<AnimeRegion> pageInfo = new PageInfo<AnimeRegion>(list,5);
        return pageInfo;
    }

    @Override
    public Integer addAnimeRegion(AnimeRegion animeRegion) {
        return animeRegionDao.addAnimeRegion(animeRegion);
    }

    @Override
    public Integer updateAnimeRegion(AnimeRegion animeRegion) {
        return animeRegionDao.updateAnimeRegion(animeRegion);
    }

    @Override
    public Integer deleteAnimeRegion(Integer regionId) {
        return animeRegionDao.deleteAnimeRegion(regionId);
    }
}
